<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
</head>
<style>
    body {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        background-color: transparent !important;
    }
	.exit {
	   width:100%;
	   background-color: #FFFFFF;
	   border-radius:10px;
	    color: #737377;
	    margin-bottom: 10px;
	}
	.exit>button {
	   width:100%;
	   height:50px;
	   background: none;
	   border:none;
	   text-align: center;
	 	color: #737377;
	 	font-size:18px;
	}

	.mineD {
			padding: 0;
			border-radius:10px;
			width:100%;
	        background-color: #fff;
	        padding: 10px 0 ;
	        font-size:18px;
	    }
	.mineD li{
	    display: inline-block;
	    width: 31%;
	    text-align: center;
	    padding: 50px 0 4px;
	    background-size: 45px auto;
	    background-repeat: no-repeat;
	    background-position: top;
	}
	.mineD li span {
	    margin: 15px 10px 0 10px;
	    color: #737377;
	}
	.fx {
	    background-image: url("../image/fx@2x.png");
	}
	.fx_wx {
            background-image: url("../image/fx_wx@2x.png");
    }
    .fx_qq {
        background-image: url("../image/fx_qq@2x.png");
    }
    .fx_wb {
        background-image: url("../image/fx_wb@2x.png");
    }
    .fx_dx {
        background-image: url("../image/fx_dx@2x.png");
    }
</style>
<body style="min-width:0">
	<div id="wrap">

		<div id="main" style="padding:0.2em; opacity:0.6;" onclick="api.closeFrame();">
		</div>

 		<ul class="mineD" style="position: absolute;left: 0;bottom: 70px;">
			<div id="div_Favorites"> </div>
		    <li class="fx_wx" onclick="goto_wx()" tapmode="">
		        <span>
		                                    微信
		        </span>
		    </li>
		    <li class="fx_qq" tapmode="" onclick="goto_qq()">
		        <span>
		           	QQ
		        </span>
		    </li>
		    <li class="fx_dx" tapmode="" onclick="goto_dx()">
		        <span>
		           	短信
		        </span>
		    </li>
		</ul>
		<div class="exit" onclick="api.closeFrame();" style="position: absolute;left: 0;bottom: 10px;">
		      <button>取消</button>
		</div>
	</div>
	<input id="hf_newsTitle" type="hidden" value=""/>
    <input id="hf_newsDesc" type="hidden" value=""/>
    <input id="hf_newsUrl" type="hidden" value=""/>
    <input id="hf_newsImg" type="hidden" value=""/>
</body>
<script src="../script/api.js"></script>
<script src="../script/zepto.min.js"></script>
<script src="../script/alpenlicebe.js"></script>
<script>
	function goto_dx(){
		api.sms({
		    numbers:'',
		    text:'【'+$("#hf_newsTitle").val()+'】'+$("#hf_newsUrl").val()
		},function(ret, err){

		});
	}
	function goto_qq(){
		var obj = api.require('qq');
		obj.installed(function(ret,err){
		    if(ret.status){
          obj.shareText({
              text: $("#hf_newsTitle").val()+"\n"+$("#hf_newsUrl").val(),
          },function(ret,err){
            if (ret.status){
              alert("分享成功！");
            } else {
              api.alert({msg: JSON.stringify(err)});
            }
          });

		    //    obj.shareNews({
				//     url:$("#hf_newsUrl").val(),
				//     title:$("#hf_newsTitle").val(),
				//     description:$("#hf_newsDesc").val(),
				//     imgUrl:'widget://res/logo_fx.png',
				//     type:'QFriend'
				// },function(ret_fx,err_fx){
				// 	if(ret_fx.status){
				// 		api.alert({title: '系统提示',msg: '分享成功', buttons: ['确定']});
				// 	}else{
				// 		//api.alert({title:'系统提示',msg:$api.jsonToStr(err_fx)});
				// 	}
				// });
		    }else{
		        api.alert({title:'系统提示',msg:'您还未安装QQ手机客户端'});
		    }
		});
	}
	function goto_wx(){
		try
		{
			var weiXin = api.require('weiXin');
			weiXin.registerApp(
			    function(ret,err){
			        if (ret.status) {
			            weiXin.sendRequest({
						    scene:'session',
						    contentType:'text',
						    title:$("#hf_newsTitle").val(),
						    description:$("#hf_newsTitle").val()+"\n"+$("#hf_newsUrl").val(),
						    thumbUrl:'widget://res/logo_fx.png',
						    // contentUrl:$("#hf_newsUrl").val()
						},function(ret,erra){
						    if(ret.status){
						        api.alert({title: '系统提示',msg: '分享成功', buttons: ['确定']});
						    } else{
						        //api.alert({title: '系统提示',msg: erra.code,buttons: ['确定']});
						    };
						});
			        } else{
			            api.alert({title: '系统提示',msg: err.msg,buttons: ['确定']});
			        }
			    }
			);
		}
		catch(rr){
			api.alert({title: '系统提示',msg: rr.message,buttons: ['确定']});
		}
	}

    apiready = function () {

        $("#hf_newsTitle").val(api.pageParam.newsTitle);
		$("#hf_newsDesc").val(api.pageParam.newsDesc);
		$("#hf_newsUrl").val(api.pageParam.newsUrl);
		$("#hf_newsImg").val(api.pageParam.newsImg);

    }
</script>
</html>
